<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
    <div></div>
    <span></span>
    <form action=""></form>
    <span></span>


</body>
<script type="text/javascript">
    for (var i = 0; i < 5; i++) {
        (function(i) {
            setTimeout(function() {
                console.log(i)
            }, 1000)
        })(i)
    }
    console.log(i)
        //最先输出的是19行的i，间隔一秒之后，同时输出0-4
</script>

</html>